# ==================================================================================
# Excel处理Makefile生成器
# ==================================================================================
# 功能说明：
#   根据 Excel 文件列表（list.txt）自动生成两个 makefile：
#   1. excel_gen.makefile      - 用于将Excel转换为proto和二进制配置文件
#   2. resmetas_gen.makefile   - 用于生成资源元数据文件
# 
# 输入：
#   ${RESDB_EXCELMMO_PATH}/list.txt  - Excel文件名列表（每行一个文件名，不含扩展名）
# 
# 输出：
#   ${PROTOCGEN_FILE_PATH}/excel_gen.makefile      - 临时makefile
#   ${PROTOCGEN_FILE_PATH}/resmetas_gen.makefile   - 临时makefile
#   这些文件会被复制到 ${RESMETAS_MAKEFILE_PATH}/ 供后续使用
# 
# 依赖关系：
#   Excel文件列表变更时，会重新生成makefile
# ==================================================================================

include ./define.makefile

.PHONY:all

all:${PROTOCGEN_FILE_PATH}/excel_gen.makefile ${PROTOCGEN_FILE_PATH}/resmetas_gen.makefile

# ----------------------------------
# 生成Excel处理makefile
# ----------------------------------
${PROTOCGEN_FILE_PATH}/excel_gen.makefile ${PROTOCGEN_FILE_PATH}/resmetas_gen.makefile:${RESDB_EXCELMMO_PATH}/list.txt
	@echo "  创建临时目录..."
	mkdir -p ${PROTOCGEN_FILE_PATH}
	mkdir -p ${RESMETAS_MAKEFILE_PATH}
	@echo "  根据Excel列表生成makefile..."
	${NFEXCELPROCESS} --work="exceltomakefile" --src="${EXCEL_MMO_FILES_LIST}" --dst="${PROTOCGEN_FILE_PATH}/"
	@echo "  复制makefile到目标目录..."
	${FILE_COPY_EXE} --work="filecopy" --patch=${GAME_VERSION_PATCH} --src="${PROTOCGEN_FILE_PATH}/excel_gen.makefile ${PROTOCGEN_FILE_PATH}/resmetas_gen.makefile" --dst=${RESMETAS_MAKEFILE_PATH}/
